package com.itheima.thread;

import javax.swing.*;

public class Demo07 {
    public static void main(String[] args) {

        Thread t1 = new Thread(new MyRun());
        Thread t2 = new Thread(new MyRun());
        t1.setName("宝强");
        t2.setName("徐峥");
        t1.start();
        t2.start();

    }

}

class  MyRun implements Runnable{

    @Override
    public void run() {

        Thread thread = Thread.currentThread();
        for (int i = 0; i < 100; i++) {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(thread.getName()+"执行到了"+i);

        }
    }
}
